var fs = require('fs');
var file = 'test.db'; //这里写的就是数据库文件的路径
var exists = fs.existsSync(file);
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database(file);

var db = new sqlite3.Database('test.db', function() {
    db.run("create table test(name varchar(15))", function() {
        db.run("insert into test values('hello,nodejs and sqlite3')", function() {
            db.all("select * from test", function(err, res) {
                if (!err)
                    console.log(JSON.stringify(res));
                else
                    console.log(err);
            });
        });
    });
});